/** 
 * @file PObject.h 
 * 
 * @brief  PObject class definition.
 * @author Bas du Pre
 * @date   20-05-2011
 * 
 **/ 

#pragma once

#include "BaseEvent.h"
#include "PString.h"
#include "NoPObjectList.h"

namespace Prism {
     
    class String;
    template <typename T> class NoPObjectList;
    
    /**
     * \brief The PObject class is the base class of all Prism objects.
     *
     * QObject is the heart of the Prism Object Model. This class provides 
     * subclasses with the following features:
     *   \li %Event model. See Prism::Event.
     *   \li toString() graceful fallback.
     */
    class PObject {
    public:
        friend class BaseEvent;
        
        PObject();
        virtual ~PObject();
        
    private:
        NoPObjectList<BaseEvent*> POBJECT_events;
        void linkEvent(BaseEvent *event);
        void unlinkEvent(BaseEvent *event);
        
    protected:
        virtual void native_init();
        virtual void native_deInit();
        
    public:
        /// String representation of this object.
        /// \return String representation of this object
        ///
        /// The toString() method can be used to get a useful String representation of
        /// this object. It is highly encouraged to use the following syntax style if 
        /// you override this method:
        /// \verbatim [ObjectName property1="0.0" property2='0.0' property3=[PObject]] \endverbatim
        /// It is expected that any subclass of PObject overrides the toString()
        /// method. The default implementation is merely a fallback than anything useful.
        virtual String toString();
    };
}


